using Identity.Application.Contracts.Common;
using Identity.Application.Contracts.Responses.Account;
using Identity.Application.Contracts.Services;
using Identity.Application.Users.Commands;
using MediatR;

namespace Identity.Application.Users.CommandHandler;

public class GetAllUserAccountCommandHandler : IRequestHandler<GetAllUserAccountCommand, Result>
{
    private readonly IUserService _userService;
    public GetAllUserAccountCommandHandler(IUserService userService)
    {
        _userService = userService;
    }
    public async Task<Result> Handle(GetAllUserAccountCommand request, CancellationToken cancellationToken)
    {
        var users = await _userService.GetAllUsersAsync();
        return Result.Success(users);
    }
}
